ccR.Mage.Talent = {
	-- Tier 1
		Evanesce = function() end,
		Blazing_Speed = function() end,
		Ice_Floes = 
		function()
			if ccR.Var("Use_Ice_Floes")
			and ccR.Player.Is.Moving() 
			and not ccR.Player.Is.Mounted() 
			and ccR.Target.Is.Attackable()
			and ccR.Player.Has.Spell(ICE_FLOES)
			and ccR.Spell.Is.Ready(ICE_FLOES) 
			and not ccR.Player.Has.Buff(ICE_FLOES)
			then
				ccR.Cast.Spell(ICE_FLOES) 
			end			
		end,
	-- Tier 2
		Alter_Time = function() end,
		-- Flameglow
		Ice_Barrier = 
		function()
			if ccR.Var("Use_Ice_Barrier")
			and ccR.Player.Has.Spell(ICE_BARRIER) 
			and ccR.Spell.Is.Ready(ICE_BARRIER) 
			and not ccR.Player.Has.Buff(ICE_BARRIER) 
			then 
				for x = 1, # ccR_Enemies_Within_44 do 
					local vObject = ccR_Enemies_Within_44[x] 
					if ccR.Unit.Exists(vObject) 
					and ccR.Unit.IsAlive(vObject) 
					and ccR.Unit.TargetName(vObject) == ccR.Player.Name() 
					then 
						ccR.Cast.Spell(ICE_BARRIER) 
					end 
				end 
			end
		end,
	-- Tier 3
		Ring_of_Frost = 
		function()
			if ccR.Var("Use_Ring_of_Frost")
			and	ccR.Player.Has.Spell(RING_OF_FROST) 
			and ccR.Spell.Is.Ready(RING_OF_FROST) 
			and ccR.Target.Is.Attackable()
			and ccR.Target.Count(12) >= ccR.Var("Ring_of_Frost_Count")
			then 
				ccR.Cast.Spell(RING_OF_FROST) 
				if SpellIsTargeting() then CastAtPosition(ObjectPosition("target")) end 
			end
		end,
		Ice_Ward = 
		function()
			if ccR.Var("Use_Ice_Ward")
			and ccR.Player.Has.Spell(ICE_WARD) 
			and ccR.Spell.Is.Ready(ICE_WARD)
			then
				-- Ice Ward on Tank
				if ccR.Var("Use_Ice_Ward_On_Tank")
				and (ccR.Player.Is.In.Raid() or ccR.Player.Is.In.Dungeon())
				then
					local vGroupType = nil
					local vTank = nil
					if ccR.Player.Is.In.Dungeon() then vGroupType = "party" end;
					if ccR.Player.Is.In.Raid() then vGroupType = "raid" end;
					if vGroupType == nil then return end
					local vPlayerCount = GetNumGroupMembers()
					for i = 0, vPlayerCount do
						vTank = vGroupType .. i
						if vTank ~= nil 
						and UnitGroupRolesAssigned(vTank) == "TANK" 
						and ccR.Spell.Is.InRange(ICE_WARD, vTank)
						and ccR.Unit.Is.In.LineOfSight(vTank, "player")
						and not ccR.Unit.Has.Buff(vTank, ICE_WARD)
						then 
							ccR.Cast.Spell(ICE_WARD, vTank)
						end
					end
				end
				-- Ice Ward on Player
				if not ccR.Player.Has.Buff(ICE_WARD) then 
					for x = 1, # ccR_Enemies_Within_44 do 
						local vObject = ccR_Enemies_Within_44[x] 
						if ccR.Unit.Exists(vObject) 
						and ccR.Unit.IsAlive(vObject) 
						and (ccR.Unit.TargetName(vObject) == ccR.Player.Name())
						and ccR.Unit.Is.WithinMelee(vObject, "player") 
						and not ccR.Unit.Is.Frozen(vObject)
						then 
							ccR.Cast.Spell(ICE_WARD,"player") 
						end 
					end 
				end
			end
		end,
		Frostjaw = 
		function()
			if ccR.Var("Use_Frostjaw")
			and	ccR.Player.Has.Spell(FROSTJAW) 
			and ccR.Player.Has.Talent(FROSTJAW) 
			and ccR.Target.Is.Attackable()
			and ccR.Player.Is.Facing("target") 
			and ccR.Spell.CanAttack(FROSTJAW) 
			and (not ccR.Player.Is.Moving() or ccR.Player.Has.Buff(ICE_FLOES))
			and not ccR.Target.Is.Boss()
			then 
				ccR.Cast.Attack(FROSTJAW) 
			end
		end,
	-- Tier 4
		Greater_Invisibility = function() end,
		-- Cauterize
		Cold_Snap = function() end,
	-- Tier 5
		-- Arcane
		Nether_Tempest = function() end,
		-- Unstable Magic
		Supernova = function() end,
		-- Fire
		Living_Bomb = function() end,
		-- Unstable Magic
		Blast_Wave = function() end,
		-- Frost
		Frost_Bomb = 
		function() 
			if ccR.Player.Has.Spell(FROST_BOMB) 
			and ccR.Player.Has.Talent(FROST_BOMB) 
			and ccR.Player.Is.Facing("target") 
			and ccR.Spell.CanAttack(FROST_BOMB) 
			and not ccR.Target.HasMyDebuff(FROST_BOMB) 
			then 
				ccR.Cast.Attack(FROST_BOMB) 
			end
		end,
		-- Unstable Magic
		Ice_Nova = 
		function(style) 
			if style == nil then style = "target" end
			if ccR.Player.Has.Spell(ICE_NOVA) 
			and (
					(style == "aoe" and ccR.Player.Count(8) > 0)
					or
					(style == "target" and ccR.Spell.CanAttack(ICE_NOVA) and not ccR.Target.Is.Frozen())
				)
			then 
				ccR.Cast.AF.Attack(ICE_NOVA) 
			end
		end,
	-- Tier 6
		Mirror_Image = 
		function() 
			if ccR.Player.Has.Spell(MIRROR_IMAGE)
			and ccR.Spell.Is.Ready(MIRROR_IMAGE) 
			then 
				ccR.Cast.Spell(MIRROR_IMAGE)
			end
		end,
		Rune_of_Power = 
		function()
			if ccR.Player.Has.Spell(RUNE_OF_POWER) 
			and ccR.Spell.Is.Ready(RUNE_OF_POWER) 
			and ccR.Player.Has.Talent(RUNE_OF_POWER) 
			and not ccR.Player.Has.Buff(RUNE_OF_POWER) 
			and not ccR.Player.Is.Moving() 
			then 
				ccR.Cast.Spell(RUNE_OF_POWER) 
				if SpellIsTargeting() then CastAtPosition(ObjectPosition("player")) end
			end		
		end,
		-- Incanters Flow
	-- Tier 7
		-- Arcane
			-- Overpowered 
			Arcane_Orb = function() end,
		-- Fire
			-- Kindling
			Meteor = function() end,
		-- Frost
			-- Thermal Void
			Comet_Storm = 
			function() 
				if ccR.Player.Has.Spell(COMET_STORM) 
				and ccR.Spell.Can.Attack(COMET_STORM) 
				then 
					ccR.Cast.AF.Attack(COMET_STORM) 
				end
			end,
		Prismatic_Crystal = 
		function()
			if ccR.Target.Is.Attackable()
			and ccR.Spell.Is.Ready(PRISMATIC_CRYSTAL)
			and ccR.Target.Distance() <= 40
			then
				ccR.Cast.AoE(PRISMATIC_CRYSTAL, "target", 40, 12)
			end

			if ccR.Player.Crystal.Exists() then ccR.Player.Crystal.Target() end
		end,
}
setmetatable(ccR.Mage.Talent,ccR.Mage)